{include file="public/head"}
<style>
    .header{
        width: 100%;
    }

    .header .title{
        width: 100%;
        padding: 2rem 0 1rem 2rem;
        font-size: 1rem;
    }

    .header .centent {
        padding: 1rem 0 1rem 2rem;
        font-size: 1.4rem;
    }

    .header .centent input {
        outline: none;
        border: none;
        font-size: 1.7rem;
    }

    .header .other {
        padding: .5rem 0 1rem 2rem;
        font-size: .8rem;
    }

    .header .other input {
        outline: none;
        border: none;
        border-bottom: 1px solid black;
        margin-left: 1rem;
    }

    .header .tips {
        padding: .5rem 0 1rem 2rem;
        font-size: .5rem;
        color: silver;
    }

    .list{
        width: 100%;
        height: 15.5rem;
        padding: 1rem;
    }

    .list ul:first-child{
        height: 1.5rem;
        line-height: 1.5rem;
        overflow: hidden;
    }

    .list ul:last-child{
        height: calc(100% - 1.5rem);
        overflow-y: scroll;
    }

    .list li{
        display: flex;
        justify-content: space-between;
        align-items: center;
        line-height: 2;
        font-size: 14px;
    }

    .list li span {
        width: 25%;
        display: inline-block;
    }

    .list li span:last-child{
        text-align: right;
    }

    .list li span:nth-child(2) {
        text-align: center;
    }

    .list li span:nth-child(3) {
        text-align: center;
    }

    .list .top {
        font-weight: 700;
    }

    .sub{
        width: 95%;
        background-color: #f23030;
        border: none;
        border-radius: .1rem;
        font-weight: 600;
        color:white;
        margin: 2rem 0 1rem 2.5%;
        padding: .5rem;
    }
    .zfpassword{
        margin: 1rem;
    }
    .zfpassword input{
        border: 1px solid #000;
        border-radius:3px;
        padding: .5rem 0;
        width: 100%;
    }


    .layui-layer-btn{
        display: flex;
        justify-content: space-between;
    }
</style>
<body>

<header class="aui-header-default aui-header-fixed aui-header-bg">
    <a href="javascript:history.back(-1)" class="aui-header-item">
        <i class="aui-icon aui-icon-back-white"></i>
    </a>
    <div class="aui-header-center aui-header-center-clear">
        <div class="aui-header-center-logo">
            <div class="aui-car-white-Typeface">资金转换</div>
        </div>
    </div>
    <a href="#" class="aui-header-item-icon"   style="min-width:0">
        <!--        <i class="aui-icon aui-icon-member"></i>-->
    </a>
</header>

<section class="aui-settle-content">
    <div class="header">
        <div class="title">转换数量</div>
        <div class="centent">
            <span>￥</span>
            <input type="text" id="num" placeholder="0.00" onkeyup="this.value= this.value.match(/\d+(\.\d{0,2})?/) ? this.value.match(/\d+(\.\d{0,2})?/)[0] : ''"/>
        </div>
        <div class="tips">转换比例：{$Config.parameter_3}炁点 = 1股权</div>
    </div>
    <div class="aui-dri"></div>
    <div class="aui-settle-choice">
        <div class="aui-settle-ways">
            选择转换类型
        </div>
        <a href="javascript:" class="aui-address-cell  aui-fl-arrow-clear">
            <div class="aui-address-cell-hd">
                <img src="__STATIC__/User/img/icon/reward.png" alt="">
            </div>
            <div class="aui-address-cell-bd">
                炁点转换股权
                <p>炁点：{$UserInfo.balance_2}</p>
            </div>
            <div class="aui-address-cell-ft"><input type="radio" name="type" value="2" class="check check-pay goods-check goodsCheck" checked="checked"></div>
        </a>
        <a href="#" class="aui-address-cell  aui-fl-arrow-clear">
            <div class="aui-address-cell-hd">
                <img src="__STATIC__/User/img/icon/point.png" alt="">
            </div>
            <div class="aui-address-cell-bd">
                奖金转换电子钱包
                <p>奖金：￥{$UserInfo.balance_1}</p>
            </div>
            <div class="aui-address-cell-ft"><input type="radio" name="type" value="1" class="check check-pay goods-check goodsCheck" ></div>
        </a>
        <!--        <a href="#" class="aui-address-cell  aui-fl-arrow-clear">-->
        <!--            <div class="aui-address-cell-hd">-->
        <!--                <img src="__STATIC__/User/img/icon/shares.png" alt="">-->
        <!--            </div>-->
        <!--            <div class="aui-address-cell-bd">-->
        <!--                招商银行-->
        <!--                <p>储蓄卡（8890）</p>-->
        <!--            </div>-->
        <!--            <div class="aui-address-cell-ft"><input type="radio" name="pay_type" value="3" class="check check-pay goods-check goodsCheck"></div>-->
        <!--        </a>-->
    </div>
    <input type="submit" class="sub" value="确认转换">
    <div class="list">
        <ul class="top">
            <li>
                <span>转换类型</span>
                <span>转换数量</span>
                <span>转换时间</span>
            </li>
        </ul>
        <ul>
            {volist name="FinanceList" id="v"}
            <li>
                <span>
                    {if condition="$v.type eq 1"}奖金转换电子钱包
                    {elseif condition="$v.type eq 2"}炁点转换股权
                    {/if}
                </span>
                <span>{$v.num}</span>
                <span>{$v.add_time|date="m-d H:i",###}</span>
            </li>
            {/volist}
        </ul>
    </div>
</section>
<script type="text/javascript" src="__STATIC__/User/js/jquery.min.js"></script>
<script type="text/javascript" src="__STATIC__/Admin/layer/layer.js"></script>
<script>
    $(function () {
        $("input[name='type']").change(function () {
            var type = $("input[name='type']:checked").val();
            if (type == 2) {  //炁点转换股权
                var parameter_3 = "{$Config.parameter_3}";
                var tips = "转换比例：" + parameter_3 + "炁点 = 1股权";
            }
            if (type == 1) {  //奖金转换电子钱包
                var parameter_3 = "1";
                var tips = "转换比例：" + parameter_3 + "奖金 = 1电子钱包";
            }

            $(".tips").html(tips)

        });

        $(".sub").on('click', function () {
            var num = $("#num").val();
            var type = $("input[name='type']:checked").val();
            if (num <= 0 || num == "") {
                alert('请输入转换数量');
                return false;
            }
            layer.open({
                type: 1,
                title: '请输入支付密码',
                area: ["80%", "9.5rem"],
                closeBtn: 1,
                // skin: 'layui-layer-lan'
                content: '<div class="zfpassword"><input type="password" id="paypassword" placeholder="请输入支付密码" style="padding:  .2rem .5rem"></div>',
                btn: ['确定', '取消'],
                yes: function () {
                    var password = document.getElementById('paypassword');
                    $.ajax({
                        type: "POST",
                        url: "{:url('User/UserRechange')}",
                        data: {
                            num: num,
                            type: type,
                            password: password.value
                        },
                        dataType: "json",
                        success: function (data) {
                            if (data.status == 1) {
                                alert(data.message);
                                window.location.reload();
                            } else {
                                alert(data.message);
                            }
                        }
                    })
                }
            })
        })
    })
</script>
</body>
</html>